# -*-* encoding:UTF-8 -*-
# author            : mengy
# date              : 2019/1/28
# python-version    : Python 3.7.0
# description       : 文章实体类


class Article(object):
    """
    文章实体类
    """
    articleId = ''
    articleType = None
    articleTags = None
    title = ''
    content = ''
    date = ''
    author = None
    illustration = ""
    status = ""
    createTime = ""
    modifyTime = ""
    likeCnt = 0
    commentCnt = 0

    previousArt = {}
    nextArt = {}

    isLocked = False

    def __init__(self, **entries):
        self.__dict__.update(entries)

    def article2dict(self, article):
        return {
            'articleId': article.articleId,
            'articleType': article.articleType,
            'articleTags': article.articleTags,
            'title': article.title,
            'content': article.content,
            'date': article.content,
            'author': article.author,
            'illustration': article.illustration,
            'status': article.status,
            'createTime': article.createTime,
            'modifyTime': article.modifyTime,
            "likeCnt": article.likeCnt,
            "commentCnt": article.commentCnt,
            "previousArt":article.previousArt,
            "nextArt":article.nextArt
        }
